class MinStack {
public:
    /** initialize your data structure here. */
    stack<int> s1, s2;
    MinStack() {

    }

    void push(int x) {
        if (s2.empty() || s2.top() >= x) s2.push(x);
        s1.push(x);
    }

    void pop() {
        int t1 = s1.top();
        int t2 = s2.top();
        if (t1 == t2) s2.pop();
        s1.pop();
    }

    int top() {
        int r = s1.top();
        return r;
    }

    int min() {
        int Min = s2.top();
        return Min;
    }
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(x);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->min();
 */